<div class="signin">
    <div class="left">
        <img src="<?=IMG_PATH?>/login_left.png">
    </div>
    <div class="mid">
    	<div><input id="email" class="input email" type="text" /></div>
    	<div><input id="password" class="input password" type="password" /></div>
    	<div><input id="code" class="input code" type="text" /></div>
    	<div><img class="code_img" id="code_img" src="http://<?=HOST?>/auth/code/<?=time()?>" /></div>
    	<div id="signin_btn" class="signin_btn hover"></div>
    	<div id="password_btn" class="password_btn hover"></div>
    </div>
    <div class="right">
        <img src="<?=IMG_PATH?>/login_right.png">
    </div>
</div>
<div class="btm"></div>
<script type="text/javascript">
    $("#email").focus();
    $("#signin_btn").click(function (){
        $("#errmsg").text("");
        var email = $.trim($("#email").val());
        var password = $.trim($("#password").val());
        var code = $("#code").val();
        $.ajax({
              url: "http://<?=HOST?>/sign/doSignIn",
              cache: false,
              timeout:10000,
              type: "POST",
              data: {
                email:email,
                password:password,
                code:code
              },
              dataType: "json",
              beforeSend: function() {
                  disableHTML(true, '请稍等，登录中……', true);
              },
              success: function(data) {
                  if(data.errCode != 0){
                      disableHTML(true, data.errMsg, false);
                      setTimeout(disableHTML,2000);
                        $("#errmsg").text(data.errMsg);
                        $("#email").focus();
                        changeAuthCode();
                  }else{
                    disableHTML(true, '登录成功，跳转中……', true);
                    setTimeout("location.href = 'http://<?=HOST?>/'", 500);
                  }
              },
              error:function(){
                      disableHTML(true, "请求出错，请重试或联系系统管理员", false);
                      setTimeout(disableHTML,2000);
                      changeAuthCode();
                  }
            });
        });
    $("#code_img").click(function(){changeAuthCode()});
    function changeAuthCode()
    {
        add = Date.parse(new Date());
        codeImgUrl = "http://<?=HOST?>/auth/code/" + add;
        $("#code_img").attr('src', codeImgUrl);
    }
    $("#password_btn").click(function (){
    	location.href = 'http://<?=HOST?>/help/help';
    });
</script>